<% title _('Puppet Environments') %>

<%= environments_title_actions %>

<table class="<%= table_css_classes 'table-fixed' %>">
  <thead>
    <tr>
      <th class="col-md-8"><%= sort :name, :as => s_('Environment|Name') %></th>
      <th><%= _('Hosts') %></th>
      <th><%= _('Actions') %></th>
    </tr>
  </thead>
  <tbody>
    <% @environments.each do |environment| %>
      <tr>
        <td class="ellipsis">
          <%= link_to_if_authorized environment.name, hash_for_edit_environment_path(:id => environment).merge(:auth_object => environment, :authorizer => authorizer) %>
        </td>
        <td><%= link_to hosts_count[environment], hosts_path(:search => "environment = #{environment}") %></td>
        <td>
          <%= action_buttons(link_to(_('Classes'), puppetclasses_path(:search => "environment = #{environment}")),
                             import_proxy_links(hash_for_import_environments_environments_path(:env => environment)),
                             display_delete_if_authorized(hash_for_environment_path(:id => environment).merge(:auth_object => environment, :authorizer => authorizer), :data => { :confirm => "Delete #{environment.name}?" })) %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>
<%= will_paginate_with_info @environments %>
